package org.finesys.system.convert;

import java.util.List;

import org.finesys.system.api.dto.RouteConfDto;
import org.finesys.system.api.entity.SysRouteConf;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

@Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface SysRouteConfConvert {

    SysRouteConfConvert INSTANCE = Mappers.getMapper(SysRouteConfConvert.class);

    /**
     * 转换AppDto为SysApp对象
     */
    @Mappings({
            @Mapping(target = "createBy", ignore = true),
            @Mapping(target = "updateBy", ignore = true),
            @Mapping(target = "createTime", ignore = true),
            @Mapping(target = "updateTime", ignore = true),
            @Mapping(target = "params", ignore = true),
            @Mapping(target = "id", ignore = true),
            @Mapping(target = "delFlag", ignore = true),

    })
    SysRouteConf convert(RouteConfDto routeConfDto);

    /**
     * 转换SysApp为AppDto对象
     */
    RouteConfDto convert(SysRouteConf routeConfDto);

    /**
     * 数组转换
     */
    List<RouteConfDto> convertList(List<SysRouteConf> list);

    /**
     * 分页对象转换
     */

    @Mappings({
            @Mapping(target = "optimizeJoinOfCountSql", ignore = true)
    })
    Page<RouteConfDto> convertPage(Page<SysRouteConf> appDO);


}
